<template>
  <view>
    <view class="w100 pl-24 pr-24 pt-12">
      <view class="w100 h-68 br-34 rowsb rowsm pl-42 pr-4 mb-20" style="border: 2rpx solid #4886FF;">
        <input type="text" placeholder="输入搜索" v-model="title" placeholder-class="fs-26 col888">
        <view class="w-98 h-60 br-30 rowsc rowsm" style="background: linear-gradient(to bottom,#4897FF,#4878FF);" @click="getList">
          <image src="/static/icon_osbc-1.png" class="w-28 h-28" mode="" ></image>
        </view>
      </view>
      
      <view class="w100 p-all-24 bgff br-20 mb-20 rows rowsm" v-for="(item,index) in list" :key="index" @click="$tools.goNext('/pages/index/newsDetail?id=' + item.id)">
        <!-- <image :src="item.image" class="w-284 h-182 br-20 mr-32" mode=""></image> -->
        <view class="rowscl w100">
          <view class="fs-26 mb-96 col000">{{item.title}}</view>
          <view class="fs-24 rows rowsm" style="color: #ccc;flex-direction: row-reverse;">{{item.createTime}}</view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        list:[],
        total:0,
        limit: {
          pageNum: 1,
          pageSize: 10
        },
        title:''
      };
    },
    onLoad() {
      this.getList()
    },
    onReachBottom() {
      if (this.list.length < this.total) {
        this.limit.pageNum++;
        this.getList()
      }
    },
    onPullDownRefresh() {
      this.limit.pageNum = 1
      this.getList()
    },
    methods:{
      getList(){
        this.$tools.axiosFromToken('POST',`prozczx/list?pageNum=${this.limit.pageNum}&pageSize=${this.limit.pageSize}&title=${this.title}`,{},'加载中').then(res => {
          if(res.code != 200) return this.$tools.showtt(res.msg)
           this.total = res.total
          if (this.limit.pageNum == 1) {
              this.list = res.rows;
            } else {
              this.list = [...this.list, ...res.rows];
            }
        })
      }
    }
  }
</script>

<style lang="scss">

</style>
